package com.lenovo.mso2o.entity.g;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import de.greenrobot.dao.AbstractDaoMaster;
import de.greenrobot.dao.identityscope.IdentityScopeType;

import com.lenovo.mso2o.entity.g.NotificationDao;
import com.lenovo.mso2o.entity.g.AttachmentDao;
import com.lenovo.mso2o.entity.g.ProjectDao;
import com.lenovo.mso2o.entity.g.SiteDao;
import com.lenovo.mso2o.entity.g.StationDao;
import com.lenovo.mso2o.entity.g.AdDao;
import com.lenovo.mso2o.entity.g.SysDictDao;
import com.lenovo.mso2o.entity.g.StepIconDao;
import com.lenovo.mso2o.entity.g.FileCacheDao;
import com.lenovo.mso2o.entity.g.SyncCodeDao;
import com.lenovo.mso2o.entity.g.UploadLocationDao;
import com.lenovo.mso2o.entity.g.AutoSignOrderDao;
import com.lenovo.mso2o.entity.g.UrlSaverDao;
import com.lenovo.mso2o.entity.g.AlarmTimeDao;
import com.lenovo.mso2o.entity.g.SlaAlarmDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * Master of DAO (schema version 37): knows all DAOs.
*/
public class DaoMaster extends AbstractDaoMaster {
    public static final int SCHEMA_VERSION = 37;

    /** Creates underlying database table using DAOs. */
    public static void createAllTables(SQLiteDatabase db, boolean ifNotExists) {
        NotificationDao.createTable(db, ifNotExists);
        AttachmentDao.createTable(db, ifNotExists);
        ProjectDao.createTable(db, ifNotExists);
        SiteDao.createTable(db, ifNotExists);
        StationDao.createTable(db, ifNotExists);
        AdDao.createTable(db, ifNotExists);
        SysDictDao.createTable(db, ifNotExists);
        StepIconDao.createTable(db, ifNotExists);
        FileCacheDao.createTable(db, ifNotExists);
        SyncCodeDao.createTable(db, ifNotExists);
        UploadLocationDao.createTable(db, ifNotExists);
        AutoSignOrderDao.createTable(db, ifNotExists);
        UrlSaverDao.createTable(db, ifNotExists);
        AlarmTimeDao.createTable(db, ifNotExists);
        SlaAlarmDao.createTable(db, ifNotExists);
    }
    
    /** Drops underlying database table using DAOs. */
    public static void dropAllTables(SQLiteDatabase db, boolean ifExists) {
        NotificationDao.dropTable(db, ifExists);
        AttachmentDao.dropTable(db, ifExists);
        ProjectDao.dropTable(db, ifExists);
        SiteDao.dropTable(db, ifExists);
        StationDao.dropTable(db, ifExists);
        AdDao.dropTable(db, ifExists);
        SysDictDao.dropTable(db, ifExists);
        StepIconDao.dropTable(db, ifExists);
        FileCacheDao.dropTable(db, ifExists);
        SyncCodeDao.dropTable(db, ifExists);
        UploadLocationDao.dropTable(db, ifExists);
        AutoSignOrderDao.dropTable(db, ifExists);
        UrlSaverDao.dropTable(db, ifExists);
        AlarmTimeDao.dropTable(db, ifExists);
        SlaAlarmDao.dropTable(db, ifExists);
    }
    
    public static abstract class OpenHelper extends SQLiteOpenHelper {

        public OpenHelper(Context context, String name, CursorFactory factory) {
            super(context, name, factory, SCHEMA_VERSION);
        }

        @Override
        public void onCreate(SQLiteDatabase db) {
            Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION);
            createAllTables(db, false);
        }
    }
    
    /** WARNING: Drops all table on Upgrade! Use only during development. */
    public static class DevOpenHelper extends OpenHelper {
        public DevOpenHelper(Context context, String name, CursorFactory factory) {
            super(context, name, factory);
        }

        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
            Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables");
            dropAllTables(db, true);
            onCreate(db);
        }
    }

    public DaoMaster(SQLiteDatabase db) {
        super(db, SCHEMA_VERSION);
        registerDaoClass(NotificationDao.class);
        registerDaoClass(AttachmentDao.class);
        registerDaoClass(ProjectDao.class);
        registerDaoClass(SiteDao.class);
        registerDaoClass(StationDao.class);
        registerDaoClass(AdDao.class);
        registerDaoClass(SysDictDao.class);
        registerDaoClass(StepIconDao.class);
        registerDaoClass(FileCacheDao.class);
        registerDaoClass(SyncCodeDao.class);
        registerDaoClass(UploadLocationDao.class);
        registerDaoClass(AutoSignOrderDao.class);
        registerDaoClass(UrlSaverDao.class);
        registerDaoClass(AlarmTimeDao.class);
        registerDaoClass(SlaAlarmDao.class);
    }
    
    public DaoSession newSession() {
        return new DaoSession(db, IdentityScopeType.Session, daoConfigMap);
    }
    
    public DaoSession newSession(IdentityScopeType type) {
        return new DaoSession(db, type, daoConfigMap);
    }
    
}
